<?php
/*
|--------------------------------------------------------------------------
| Admin.php
|--------------------------------------------------------------------------
| auther:Liutiansi
| Email:liutiansi@gmail.com
| update:2009-03-28
|
*/
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Admin extends Controller
{

/*
|--------------------------------------------------------------------------
| siteinfo Initialization;
|--------------------------------------------------------------------------
|
| include page head info、load library、default language...
| 
|
*/	
	private $data	    = array();
        private $Condition  = array();
	public function Admin()
	{
		parent::Controller();
                @session_start();
		$this->load->library('phpsession');	
                $this->load->library('bashlib');
		$this->load->model('admin_model');
		$this->load->database();
		$this->load->helper('url');
		$this->load->helper('form');
		$this->load->helper('bash');
                if (strlen($this->phpsession->get('currlanguage'))==2){
                        $this->config->set_item('language',$this->phpsession->get('currlanguage')); 
                }
		$this->data['charset']	= $this->config->item('charset');
                $this->data['title']	= $this->config->item('title');
                $this->data['keywords']	= $this->config->item('keywords');
                $this->data['description']= $this->config->item('description');
                $this->data['lang']= $this->config->item('language');
                $this->lang->load('base',$this->config->item('language'));	
	}

        public function index()
        {
		$this->load->view('index_view', $this->data);
            
        }


/*
|--------------------------------------------------------------------------
| main page;
|--------------------------------------------------------------------------
|
| out main welcome page
| 
|
*/
        public function main()
        {
                $this->load->view('index_view', $this->data);
        }

 /*
|--------------------------------------------------------------------------
| out 404 page;
|--------------------------------------------------------------------------
|
| out 404 page;
| 
|
*/	
	public function error_404()
        {
		$this->data['currpage']="ERROR 404";
                $this->data['title']   .=$this->data['title']." ERROR 404";
		$this->load->view('error_404_view');    
	}
        
        
 /*
|--------------------------------------------------------------------------
| out system info page;
|--------------------------------------------------------------------------
|
| out system info page;
| 
|
*/	
	public function error_system($message)
        {
                $this->data['currpage']="system info";
                $this->data['title']   .=$this->data['title']." System info page";
                $get_message=base64_decode(str_replace(array('-','_'),array('+','/'),$message));
                if (substr_count($get_message,'|')>0)
                {
                        $message_array=explode("|",$get_message);
                        $message_key=$message_array[0];
                        $message_str=$message_array[1];
                        
                        //*
                        //'1'       ->      javascript:window.history.go(-1);
                        //'2'       ->      javascript:window.close();
                        //'URL(/login)' ->   javascript:widnow.location.href='/login';
                        //*
                        if ($message_key=="1")
                                $back_do="<a href=\"javascript:window.history.go(-1)\"><img src='/images/back.gif'></a>\n";
                        else    if ($message_key=="2")
                                $back_do="<a href=\"javascript:window.close();\"><img src='/images/close.gif'></a>\n";
                        else    $back_do="<a href=\"".$message_key."\"><img src='/images/back.gif'></a>\n";
                }
                else
                {
                        $back_do="<a href=\"/\"><img src='/images/back.gif'></a>\n";
                        $message_str=$get_message;
                }
                $message_row["message_str"]=$message_str;
                $message_row["message_backdo"]=$back_do;
		$this->load->view('error_system_view',$message_row);
	}
}
